package xyz.csmcool.imuser.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import xyz.csmcool.imuser.entity.Handle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author csmcool
 * @since 2022-08-03
 */
public interface HandleMapper extends BaseMapper<Handle> {

    /**
     * 添加新的事件
     * @return
     * @param name
     * @param email
     * @param message
     */
    @Insert("INSERT INTO `sjim_handle` (`username`, `email`, `message`) VALUES (#{name},#{email},#{message});")
    Boolean addHandle(@Param("name") String name,@Param("email") String email,@Param("message") String message);

    /**
     * 回复事件
     * @param reply
     * @param id
     * @return
     */
    @Update("UPDATE sjim_handle SET reply = #{reply},isHandle=1 WHERE id = #{id}")
    Boolean reply(@Param("reply") String reply,@Param("id") Integer id);
}
